<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of dist_emd</title>
  <meta name="keywords" content="dist_emd">
  <meta name="description" content="Calculates Earth Mover's Distance (EMD) between positive vectors.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html classify -->
<h1>dist_emd
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Calculates Earth Mover's Distance (EMD) between positive vectors.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function D = dist_emd( X, Y ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Calculates Earth Mover's Distance (EMD) between positive vectors.

 Assume X is an m-by-p matrix representing m histograms with p bins each and Y is an
 n-by-p matrix representing another set of n histograms with p bins each.  Each histogram
 is assumed to have the same total weight. This function compute the m-by-n distance
 matrix D where D(i,j) is the Earth Mover's Distance (EMD) between X(i,:) and Y(j,:). 

 Note for 1D, with all histograms having equal weight, there is a simple closed form for
 the calculation of the EMD.  The EMD between two histograms x and y is simply given by
 the sum(abs(cdf(x)-cdf(y))), where cdf is the cumulative distribution function (computed
 simply by cumsum).

 INPUTS
   X   - m-by-p matrix of m p-bin histograms
   Y   - n-by-p matrix of n p-bin histograms

 OUTPUTS
   D   - m-by-n distance matrix

 EXAMPLE
   X=[randn(100,5)]; Y=randn(40,5)+2;
   D = dist_emd( [X; Y], [X; Y] ); im(D)

 DATESTAMP
   29-Sep-2005  2:00pm

 See also <a href="dist_euclidean.html" class="code" title="function D = dist_euclidean( X, Y )">DIST_EUCLIDEAN</a>, <a href="dist_chisquared.html" class="code" title="function D = dist_chisquared( X, Y )">DIST_CHISQUARED</a></pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<hr><address>Generated on Wed 03-May-2006 23:48:50 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>